#ifndef __APP_SENSOR_H
#define __APP_SENSOR_H
#include "stm32f4xx.h"


typedef struct
{
	float gyro_x_raw;
	float gyro_y_raw;
	float gyro_z_raw;		//gyro raw data
	float acce_x_raw;
	float acce_y_raw;
	float acce_z_raw;		//accel raw data
	float magnet_x_raw;	
	float magnet_y_raw;
	float magnet_z_raw; //???????
	float PitchAngle_zero;	//?????
	float PitchAngleRate_offset;	//?????????
	float PitchAcce_dynamic_offset;	//?????????
	float static_pitch_angle;
	float static_roll_angle;
	float static_yaw_angle;			//????
	float fused_pitch_angle;
	float fused_roll_angle;
	float fused_yaw_angle;			//????
	float pitch_angle_rate;
	float roll_angle_rate;
}App_SensorInfo;

typedef struct{
	float accel_x_zero;
	float accel_y_zero;
	float accel_z_zero;
	
	float gyro_x_zero;
	float gyro_y_zero;
	float gyro_z_zero;
	
	float mag_x_zero;
	float mag_y_zero;
	float mag_z_zero;
}SensorZeros;

typedef struct
{
	s16 iqs[4];		// ??????
	s32 voltage;		// ???	
	s32 sys_temprature;	//????
		
	//???????				
	u32 Remote_status;	//?????????
	u32 Battery_status;	//????,?????
	u32 Foot_status;	//????
	App_SensorInfo sensor_info;           //?????
	s32 balance_flag;                     //??????, 1 ????,0 ????? 
//	ALLMCAccParam acc_param;              //???????
	
} SYSTEM_STATUS;

void SensorAppInit(void);
void SensorAppUpdateHandle(void);
void CalculateMagAngle(App_SensorInfo *str );
void UpdateYawAngle(App_SensorInfo *str );

#endif

/****************************************END OF FLIE appsensor.h**********************************************************/
